﻿@using LKVMLMADMIN.Models
@using LKVService
@{
    ViewBag.Title = "NewsDetial";
    Layout = "~/Views/Shared/_LayoutAdmin.cshtml";
}
@model NewsModel

<div class="row">
    <div class="col-lg-12">
        <h3 class="page-header">Chi tiết tin tức</h3>
    </div>
    <!-- /.col-lg-12 -->
</div>
<div class="row">
    <div class="col-lg-12">
        <div class="panel panel-default">
            @if (Model._type != 0)
            {
                using (Html.BeginForm("NewsDetail", "News", FormMethod.Post, new { @class = "login-form form-horizontal" }))
                {
                    @Html.ValidationSummary(true)
                    <div class="panel-body">
                        <div class="row">
                            <div class="col-lg-9" style="margin-left:4% !important;">
                                <form role="form">
                                    <label style="color:red">@ViewBag.Notice</label>
                                    @Html.HiddenFor(m => m.ID, new { @Value = Model.ID })
                                    @Html.HiddenFor(m => m.Status, new { @Value = Model.Status })
                                    <div class="form-group">
                                        <label>Tên bài viết:</label>@Html.TextBoxFor(m => m.TenBaiViet, new { @Value = Model.TenBaiViet, Class = "form-control" })
                                    </div>
                                    <div class="form-group ">
                                        <label>Danh mục :</label>
                                        @Html.DropDownListFor(m => m.DanhMuc_Id, Model.DanhMucItem, new { Class = "form-control", @Style = "width:200px !important;" })
                                        <a href="@Url.Action("MainCategory","News")" class="btn btn-default">Thêm danh mục</a>
                                    </div>
                                    <div class="form-group">
                                        <label>Nội dung:</label> @Html.TextAreaFor(m => m.NoiDung, new { @Value = Model.NoiDung, Class = "form-control",@Id="txtContent" })
                                    </div>
                                    <div class="form-group ">
                                        <label>Ngày tạo:</label><input type="text" value="@String.Format("{0:dd/MM/yyyy}",Model.NgayTao)" class="form-control" readonly="readonly" />
                                    </div>
                                    <div class="form-group ">
                                        <label>Người tạo:</label><input type="text" value="@Model.NguoiTao" class="form-control" readonly="readonly" />
                                    </div>
                                    <div class="form-group ">
                                        <button type="submit" class="btn btn-default">Lưu</button>
                                    </div>
                                </form>
                            </div>
                        </div>
                    </div>
                }
            }
            else
            {

                using(Html.BeginForm("AddNews", "News", FormMethod.Post, new { @class = "login-form form-horizontal" }))
                {
                    @Html.ValidationSummary(true)

                    <div class="panel-body">
                        <div class="row">
                            <div class="col-lg-9" style="margin-left:4% !important;">
                                <form role="form">
                                    <label>Tên bài viết</label>
                                    <div class="form-group">
                                        @Html.TextBoxFor(m => m.TenBaiViet, new { Class = "form-control" })
                                        <p style="color:red">@Html.ValidationMessageFor(m => m.TenBaiViet) </p>
                                    </div>
                                    <label>Danh mục</label>
                                    <div class="form-group ">
                                        @Html.DropDownListFor(m => m.DanhMuc_Id, Model.DanhMucItem, new { Class = "form-control", @Style = "width:200px !important;" })
                                        <a href="@Url.Action("MainCategory","News")" class="btn btn-default">Thêm danh mục</a>
                                    </div>
                                    <label>Nội dung</label>
                                    <div class="form-group">
                                       @Html.TextAreaFor(m => m.NoiDung, new { Class = "form-control" , @Id ="txtContent"})
                                        <p style="color:red">@Html.ValidationMessageFor(m => m.NoiDung) </p>
                                    </div>
                                    <button type="submit" class="btn btn-default">Thêm</button>
                                </form>
                            </div>
                        </div>
                    </div>
                }
            }
        </div>
    </div>
</div>  
